const showFreeMemory = new function()
{
    var obj = null;
    var timerID = 0;
    var file = null;
    var istream = null;
    
    updateTimer = function() {
        if (timerID)
            clearTimeout(timerID);
        var res = 0;
        if (obj != null) {
            res = obj.GetSystemMemory();
        }
        document.getElementById("freememory_panel").label = res + "M";
        timerID = setTimeout("updateTimer()", 2000);
    };

    this.init = function() {
        //dump(navigator.platform);
        obj = Components.classes["@dsp.com.cn/XPCOMComponent/ShowMemory;1"]
                .getService()
                .QueryInterface(Components.interfaces.IShowMemory);
        updateTimer();
    };
}

window.addEventListener('load', function() {
        /* we expect to show it BEFORE any page is loaded */
        //gBrowser.addEventListener("load", showFreeMemory.init, true);
        showFreeMemory.init();
        },
        false);
